#include "Grenade.h"
#include "RSManager.h"
#include "Box.h"
#include "Sprite.h"
#include "ShareComponents.h"


Grenade::Grenade(Box* box, int groundLevel, float angle): Object((box), ObjectType::ObjEnemy_DYNAMID), MoveObject()
{
	_sprite = RSManager::getInstance()->getSprite(GRENADE);
	_box->_size = _sprite->getRenderSize();
	AssignMove(_box);	
	_groundLevel = groundLevel;
	_isAlive = true;
	_hits = -1.0f;
	_angle = angle;
}


Grenade::~Grenade(void)
{
}

void Grenade::update()
{	
	if(_box->_position.y > _groundLevel)
		moveDiagonalThrow(_angle);
	else	
		_isAlive = false;				
}

void Grenade::render()
{
	_sprite->Render(_box->_position);
}

Box* Grenade::getCollisionBox()
{
// 	_colBox->_position = _box->_position;
// 	_colBox->_size = _box->_size;
// 	_colBox->_v = _box->_v;
//	return _colBox;
	return gl_BOX_0_0_0;
}

